package com.eight.cloud.openfeign.message.enums;

import com.eight.cloud.core.global.exception.ParameterException;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

/**
 * @EnumName: BindingNameEnum
 * @Author: TXC
 * @Date: 2025-08-15 10:10
 **/
@Getter
public enum BindingNameEnum {
    WEBSOCKET_PRODUCER("websocketProducer-out-0");
    private final String value;

    BindingNameEnum(String value) {
        this.value = value;
    }

    /**
     * 根据值获取枚举
     *
     * @param value 值
     * @return 枚举
     */
    @JsonCreator
    public static BindingNameEnum getByValue(String value) {
        for (BindingNameEnum bindingNameEnum : BindingNameEnum.values()) {
            if (bindingNameEnum.value.equals(value)) {
                return bindingNameEnum;
            }
        }
        throw new ParameterException("No enum constant with value: " + value);
    }
}
